<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <ul id="list">
      <li>列表1</li>
      <li>列表2</li>
      <li>列表3</li>
      <p>哈哈</p>
    </ul>
  </body>
</html>
<script>
  var list = document.getElementById("list");
//   list.onclick = function () {
//     console.log("点击了");
//   };

list.addEventListener('click', function (e){
  // if(event.target.tagName === 'LI'){
  // 转换小写  函数toLocaleLowerCase()
  if(event.target.tagName.toLocaleLowerCase() === 'li'){
    // console.log('点击LI标签')
    console.log(event.target.innerHTML)
  }
})


</script>
